package com.mvd.app.activity;


import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;

import com.mvd.app.R;
import com.mvd.app.ac2019.AdvanceSettingActivity;
import com.mvd.app.adapter.MyAccountModeListAdapter;
import com.mvd.app.adapter.MyProvincesListAdapter;
import com.mvd.app.application.BaseApplication;
import com.mvd.app.commons.Constants;
import com.mvd.app.commons.PDALogUtils;
import com.mvd.app.commons.SharedPreferencesUtils;
import com.mvd.app.commons.UtilsLog;
import com.mvd.app.model.IPPortModel;
import com.mvd.app.model.SettingModel;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @Description: 系统设置
 * @time 2017/6/13
 */
public class SettingActivity extends BaseActivity implements AdapterView.OnItemClickListener, CompoundButton.OnCheckedChangeListener {

    @BindView(R.id.title_btn_left)
    ImageButton titleBtnLeft;
    @BindView(R.id.title_btn_left_txt)
    Button titleBtnLeftTxt;
    @BindView(R.id.title_txt)
    TextView titleTxt;
    @BindView(R.id.iv_headtip)
    ImageView ivHeadtip;
    @BindView(R.id.title_btn_right_txt)
    Button titleBtnRightTxt;
    @BindView(R.id.title_btn_right)
    ImageButton titleBtnRight;
    @BindView(R.id.ac_setting_et_ip)
    EditText acSettingEtIp;
    @BindView(R.id.ac_setting_et_port)
    EditText acSettingEtPort;
    @BindView(R.id.ac_setting_et_jiqima)
    EditText acSettingEtJiqima;
    //    Button acSetBtnCancle;
//    @BindView(R.id.ac_set_view_m)
//    TextView acSetViewM;
    @BindView(R.id.ac_set_btn_save)
    Button acSetBtnSave;
    @BindView(R.id.ac_setting_et_ip_file)
    EditText acSettingEtIpFile;
    @BindView(R.id.ac_setting_et_port_file)
    EditText acSettingEtPortFile;
    @BindView(R.id.ac_setting_txt_moren)
    TextView acSettingTxtMoren;
    @BindView(R.id.textView6)
    TextView textView6;
    @BindView(R.id.ac_setting_set_gaoji)
    RelativeLayout acSettingSetGaoji;
    @BindView(R.id.ac_set_btn_cancle)
    Button acSetBtnCancle;
    @BindView(R.id.ac_setting_et_ip_huanbao)
    EditText acSettingEtIpHuanbao;
    @BindView(R.id.ac_setting_et_port_huanbao)
    EditText acSettingEtPortHuanbao;
    @BindView(R.id.ac_setting_et_jiancezhan_no)
    EditText acSettingEtJiancezhanNo;
    @BindView(R.id.ac_set_view_m)
    TextView acSetViewM;
    @BindView(R.id.ac_setting_txt_dache)
    Switch acSettingTxtDache;
    //    @BindView(R.id.ac_setting_txt_address)
//    TextView acSettingTxtAddress;
    @BindView(R.id.ac_setting_38900)
    Switch acSetting38900;
    @BindView(R.id.ac_setting_list_ui)
    Switch acSettingListUi;
    @BindView(R.id.ac_setting_xue)
    Switch acSettingXue;
    @BindView(R.id.ac_setting_special_carMode)
    Switch acSettingSpecialCarMode;
    @BindView(R.id.ac_setting_da_car)
    Switch acSettingDaCar;
    @BindView(R.id.ac_setting_di_gou)
    Switch acSettingDiGou;
    @BindView(R.id.ac_setting_open_sign)
    Switch acSettingOpenSign;
    @BindView(R.id.ac_setting_yasuoPhoto)
    Switch acSettingyasuoPhoto;
    @BindView(R.id.ac_setting_dongtai_img)
    Switch aSwitch_dongtai_img;
    @BindView(R.id.ac_setting_road_qianyinli)
    Switch acSettingRoadQianyinli;
    //popuwindow
    private View popu_view;
    private View popu_provinces_view;
    private LinearLayout parent22;
    private RelativeLayout parent_view;
    private PopupWindow pop = null;
    private PopupWindow pop_provinces = null;
    private ListView listview_modes;
    private ListView listview_provinces;
    private List<String> strModes = new ArrayList<String>();
    private List<String> yes_no_Modes = new ArrayList<String>();
    private MyAccountModeListAdapter MyAccountModeListAdapter;
    private MyProvincesListAdapter myProAdapter;
    private String CURRENT_SELECT_TYPE = "否";
    private int SELECT_TYPE = 0;//:0：检测模式，，1：是否
    private int view_type = 0;//当前是第几个下拉列表
    //    private List<String> provinces_list = new ArrayList<String>();//省会简称列表
//    private List<String> letter_list = new ArrayList<String>();//字母列表
    SettingModel settingModel = new SettingModel();//保存系统设置的model

    private SettingActivity instance = null;
    private AlertDialog.Builder builder;

//    private String[] address = new String[]{"温州", "常山"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        ButterKnife.bind(this);
        String logStrf = "\n" + "onCreate-----系统设置-------" + "\n";
        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStrf.getBytes());
        if (SharedPreferencesUtils.getIPModel(SettingActivity.this) != null) {
            UtilsLog.e("==" + SharedPreferencesUtils.getIPModel(this).toString());
        } else {
            UtilsLog.e("=1111111111111111=");
        }
        instance = this;
        setBackBtn();
        setTopTitle(R.string.title_activity_setting);

        initData();
        pop_account();
        pop_provinces();

        acSettingTxtDache.setOnCheckedChangeListener(this);

        UtilsLog.e("是否自动刷新==" + SharedPreferencesUtils.getAutoRefresh(this));
        if (SharedPreferencesUtils.getAutoRefresh(this)) {
            acSettingTxtMoren.setText("是");
        } else {
            acSettingTxtMoren.setText("否");
        }
        //路试牵引力
        acSettingRoadQianyinli.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                SharedPreferencesUtils.setRoadQianyinli(instance, isChecked);
                acSettingRoadQianyinli.setChecked(isChecked);//设置选中
            }
        });

        //地沟检测时间
        acSettingDiGou.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                SharedPreferencesUtils.setDiGou(instance, isChecked);
                acSettingDiGou.setChecked(isChecked);   //设置选中
            }
        });
        acSettingDiGou.setChecked(SharedPreferencesUtils.getDaChe(instance));
        UtilsLog.e("管理员密码==" + SharedPreferencesUtils.getUserNickName(this));

        if (!TextUtils.isEmpty(SharedPreferencesUtils.getUserToken(this))) {
            acSettingEtJiancezhanNo.setText(SharedPreferencesUtils.getUserToken(this));
        } else {
            acSettingEtJiancezhanNo.setText(SharedPreferencesUtils.getUserToken(this));
        }

        UtilsLog.e("是否大车外检地沟分开检测==" + SharedPreferencesUtils.getIsDaCheDiGouFenLi(this));
        //是否大车外检地沟分开检测
        if (SharedPreferencesUtils.getIsDaCheDiGouFenLi(this)) {
            acSettingTxtDache.setChecked(true);
        } else {
            acSettingTxtDache.setChecked(false);
        }
        UtilsLog.e("是否压缩照片==" + SharedPreferencesUtils.getIsYasuoPhoto(this));
        //是否压缩照片
        if (SharedPreferencesUtils.getIsDaCheDiGouFenLi(this)) {
            acSettingyasuoPhoto.setChecked(true);
        } else {
            acSettingyasuoPhoto.setChecked(false);
        }

        if (SharedPreferencesUtils.getDongTaiImg(this)) {
            aSwitch_dongtai_img.setChecked(true);
        } else {
            aSwitch_dongtai_img.setChecked(false);
        }
        aSwitch_dongtai_img.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                SharedPreferencesUtils.setDongTaiImg(instance, isChecked);
                aSwitch_dongtai_img.setChecked(isChecked);   //设置选中
            }
        });
        //是否压缩照片
        acSettingyasuoPhoto.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                SharedPreferencesUtils.setIsYasuoPhoto(instance, isChecked);
                acSettingyasuoPhoto.setChecked(isChecked);   //设置选中
            }
        });
        //外检大车
        acSettingDaCar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                SharedPreferencesUtils.setDaChe(instance, isChecked);
                acSettingDaCar.setChecked(isChecked);   //设置选中
            }
        });
        acSettingDaCar.setChecked(SharedPreferencesUtils.getDaChe(instance));
        UtilsLog.e("外检大车开关==" + SharedPreferencesUtils.getDaChe(instance));
        //开启签名功能
        acSettingOpenSign.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                SharedPreferencesUtils.setOpenSign(instance, isChecked);
                acSettingOpenSign.setChecked(isChecked);//设置选中
            }
        });
//        UtilsLog.e("是否检测特殊车型==" + SharedPreferencesUtils.getIsSpecialCarMode(this));
//        //是否检测特殊车型
//        if (SharedPreferencesUtils.getIsSpecialCarMode(this)) {
//            acSettingSpecialCarMode.setChecked(true);
//        } else {
//            acSettingSpecialCarMode.setChecked(false);
//        }
//        acSettingSpecialCarMode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
//            @Override
//            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//                SharedPreferencesUtils.setIsSpecialCarMode(instance, isChecked);
//                acSettingSpecialCarMode.setChecked(isChecked);   //设置选中
//                if (isChecked) {
//                    SharedPreferencesUtils.setAddress(instance, "温州");
//                } else {
//                    SharedPreferencesUtils.setAddress(instance, "常山");
//                }
//            }
//        });
//        //选择address  城市 地区
//        if (!TextUtils.isEmpty(SharedPreferencesUtils.getAddress(this))) {
//            acSettingTxtAddress.setText(SharedPreferencesUtils.getAddress(this));
//        }
//        UtilsLog.e("选择address  城市 地区==" + SharedPreferencesUtils.getAddress(this));
        //切换队列样式
        acSettingListUi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                SharedPreferencesUtils.setPhotoClipping(instance, isChecked);
                acSettingListUi.setChecked(isChecked);   //设置选中
            }
        });
        //38900升级
        acSetting38900.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//                SharedPreferencesUtils.set38900(instance, isChecked);
                SharedPreferencesUtils.setCode2List(instance, isChecked);
                acSetting38900.setChecked(isChecked);   //设置选中
            }
        });
        acSetting38900.setChecked(SharedPreferencesUtils.getCode2List(instance));
        acSettingListUi.setChecked(SharedPreferencesUtils.getPhotoClipping(instance));

        //特殊号牌:学-警-WJ-应急
        acSettingXue.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//                SharedPreferencesUtils.set38900(instance, isChecked);
                SharedPreferencesUtils.setTeShuPai(instance, isChecked);
                acSettingXue.setChecked(isChecked);   //设置选中
            }
        });
        acSettingXue.setChecked(SharedPreferencesUtils.getTeShuPai(instance));
        acSettingOpenSign.setChecked(SharedPreferencesUtils.getOpenSign(instance));

        UtilsLog.e("路是牵引力开关==" + SharedPreferencesUtils.getRoadQianyinli(instance));
        acSettingRoadQianyinli.setChecked(SharedPreferencesUtils.getRoadQianyinli(instance));
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        String logStrf = "\n" + "onDestroy-----系统设置-------" + "\n";
        PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStrf.getBytes());
    }

    @OnClick({R.id.ac_setting_txt_moren,
            R.id.ac_set_btn_cancle, R.id.ac_set_btn_save,
            R.id.ac_setting_set_gaoji
//            , R.id.ac_setting_txt_address
    })
    public void onViewClicked(View view) {
        switch (view.getId()) {
//            case R.id.ac_setting_txt_address:
//                showHuanDialog(address, R.id.ac_setting_txt_address);
//                break;
            case R.id.ac_setting_txt_moren:
                view_type = 3;
                SELECT_TYPE = 1;
                popuwindow_type();
                pop.showAtLocation(acSettingTxtMoren, Gravity.BOTTOM, 0, 0);
                break;
            case R.id.ac_set_btn_cancle:
                finish();
                break;
            case R.id.ac_setting_set_gaoji:
                //高级设置
                showThree();
                break;
            case R.id.ac_set_btn_save:
                String strIp = null;//ip
                String strPort = null;//端口号
                String file_strIp = null;//上传文件ip
                String file_strPort = null;//上传文件端口号
                String IsAutoRefresh = "是";//是否自动刷新
                String huanbao_strIp = null;//环保ip
                String huanbao_strPort = null;//环保端口号
//                String address = null;
                String jiancezhan_no = null;//检测站编码
                jiancezhan_no = acSettingEtJiancezhanNo.getText().toString().trim();
//                address = acSettingTxtAddress.getText().toString().trim();
                IsAutoRefresh = acSettingTxtMoren.getText().toString().trim();
                strIp = acSettingEtIp.getText().toString().trim();
                strPort = acSettingEtPort.getText().toString().trim();
                file_strIp = acSettingEtIpFile.getText().toString().trim();
                file_strPort = acSettingEtPortFile.getText().toString().trim();
                huanbao_strIp = acSettingEtIpHuanbao.getText().toString().trim();
                huanbao_strPort = acSettingEtPortHuanbao.getText().toString().trim();
                if (!TextUtils.isEmpty(strIp) && !TextUtils.isEmpty(strPort)
                        && !TextUtils.isEmpty(file_strIp) && !TextUtils.isEmpty(file_strPort)
                        ) {
//                        && !TextUtils.isEmpty(huanbao_strIp) && !TextUtils.isEmpty(huanbao_strPort)) {
//                    if (!TextUtils.isEmpty(strIp) && !TextUtils.isEmpty(strPort)) {
                    //端口号与IP地址不为空的前提下验证授权码
                    String ip_port = BASE_URL_front + strIp + ":" + strPort;
                    String haunbao_ip_port = BASE_URL_front + huanbao_strIp + ":" + huanbao_strPort;
                    String file_ip_port = BASE_URL_front + file_strIp + ":" + file_strPort;

                    IPPortModel model = new IPPortModel();
                    model.setIp(strIp);
                    model.setIp_port(strPort);
                    model.setFile_ip(file_strIp);
                    model.setFile_ip_port(file_strPort);
                    model.setHuanbao_ip(huanbao_strIp);
                    model.setHuanbao_port(huanbao_strPort);
                    SharedPreferencesUtils.setIPModel(this, model);

//                    UtilsLog.e(SharedPreferencesUtils.getIPModel(this).toString());
//                    UtilsLog.e(SharedPreferencesUtils.getIP(this).toString());
//                    UtilsLog.e(SharedPreferencesUtils.getFileIP(this).toString());
                    SharedPreferencesUtils.setUserToken(this, jiancezhan_no);//检测站编码
//                    SharedPreferencesUtils.setAddress(this, address);//设置地址   温州  常山
                    SharedPreferencesUtils.setIP(this, ip_port);//一般请求接口的ip
                    SharedPreferencesUtils.setHuanBaoIP(this, haunbao_ip_port);//一般请求接口的ip
                    SharedPreferencesUtils.setFileIP(this, file_ip_port);//上传图片文件接口的ip

//                    String logStr = "\n" + "setting---" +
//                            "\n" + "model::" + model.toString() + "\n" +
//                            "Address:" + SharedPreferencesUtils.getAddress(this);
                    String logStr = "\n" + "setting---" +
                            "\n" + "model::" + model.toString() + "\n";
                    PDALogUtils.createLogFile(BaseApplication.JIANCE_MODE, logStr.getBytes());


                    //是否自动刷新数据
                    if ("是".equals(IsAutoRefresh)) {
                        SharedPreferencesUtils.setAutoRefresh(this, true);
                    } else {
                        SharedPreferencesUtils.setAutoRefresh(this, false);
                    }
                    finish();
                } else {
                    Toast.makeText(this, R.string.activity_setting_ip_null, Toast.LENGTH_SHORT).show();
                }
                break;
        }
    }

//    private void showHuanDialog(String[] str, final int id) {
//        BottomMenu.show(this, str, new OnMenuItemClickListener() {
//            @Override
//            public void onClick(String text, int index) {
//                //返回参数 text 即菜单名称，index 即菜单索引
//                switch (id) {
//                    case R.id.ac_setting_txt_address:
//                        acSettingTxtAddress.setText(text);
//                        break;
//                }
//            }
//        }).setMenuTextInfo(new TextInfo().setBold(true).setFontColor(Color.BLACK).setGravity(Gravity.CENTER));
//    }

    /**
     * 三个按钮的 dialog
     */
    View three_view;

    private void showThree() {
        three_view = getLayoutInflater().inflate(R.layout.dialog_custom_base,
                null);
//        final TextView tv_left = (TextView)three_view.findViewById(R.id.dialog_my_left);
//        final TextView tv_middle = (TextView)three_view.findViewById(R.id.dialog_my_middle);
//        final TextView tv_right =(TextView) three_view.findViewById(R.id.dialog_my_right);
        final EditText etPassword = (EditText) three_view.findViewById(R.id.dialog_my_et_content);
        builder = new AlertDialog.Builder(this).setView(three_view)
//                .setTitle("管理员密码")
                .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        String pwd = etPassword.getText().toString().trim();
                        if ("Savaboon123".equals(pwd)) {
                            //管理员密码正确
                            Intent advanceIntent = new Intent(instance, AdvanceSettingActivity.class);
                            startActivity(advanceIntent);
                        } else {
                            //管理员密码错误
                            Toast.makeText(mContext, "管理员密码错误", Toast.LENGTH_LONG).show();
                        }
                    }
                })
//                .setNeutralButton("忘记密码", new DialogInterface.OnClickListener() {
//                    @Override
//                    public void onClick(DialogInterface dialogInterface, int i) {
//                        Toast.makeText(mContext, "忘记密码", Toast.LENGTH_LONG).show();
//                    }
//                })
                .setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        //ToDo: 你想做的事情
                        Toast.makeText(mContext, "取消", Toast.LENGTH_LONG).show();
                        dialogInterface.dismiss();
                    }
                });
        builder.create().show();

    }


    protected void initData() {
        for (int i = 0; i < Constants.MY_ACCOUNT_MODEL_LIST.length; i++) {
            strModes.add(i, Constants.MY_ACCOUNT_MODEL_LIST[i]);
        }
        for (int i = 0; i < Constants.YES_NO.length; i++) {
            yes_no_Modes.add(i, Constants.YES_NO[i]);
        }
//        acSettingEtJiqima.setText(CommonUtils.getIMEI(this));
        if (SharedPreferencesUtils.getIPModel(SettingActivity.this) != null) {
            acSettingEtIp.setText(SharedPreferencesUtils.getIPModel(this).getIp());
            acSettingEtPort.setText(SharedPreferencesUtils.getIPModel(this).getIp_port());
            acSettingEtIpFile.setText(SharedPreferencesUtils.getIPModel(this).getFile_ip());
            acSettingEtPortFile.setText(SharedPreferencesUtils.getIPModel(this).getFile_ip_port());
            acSettingEtIpHuanbao.setText(SharedPreferencesUtils.getIPModel(this).getHuanbao_ip());
            acSettingEtPortHuanbao.setText(SharedPreferencesUtils.getIPModel(this).getHuanbao_port());
            UtilsLog.e(SharedPreferencesUtils.getIPModel(this).toString());
        }

    }

    private void pop_account() {
        pop = new PopupWindow(this);
        popu_view = getLayoutInflater().inflate(R.layout.item_setting_popupwindows,
                null);
        pop.setWidth(LinearLayout.LayoutParams.MATCH_PARENT);
        pop.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
        pop.setBackgroundDrawable(new BitmapDrawable());
        pop.setFocusable(true);
        pop.setOutsideTouchable(true);
        pop.setContentView(popu_view);
        listview_modes = (ListView) popu_view.findViewById(R.id.setting_listview);
    }

    private void pop_provinces() {
        pop_provinces = new PopupWindow(this);
        popu_provinces_view = getLayoutInflater().inflate(R.layout.item_setting_province_letter,
                null);
        pop_provinces.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT);
        pop_provinces.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
        pop_provinces.setBackgroundDrawable(new BitmapDrawable());
        pop_provinces.setFocusable(true);
        pop_provinces.setOutsideTouchable(true);
        pop_provinces.setContentView(popu_provinces_view);
        parent22 = (LinearLayout) popu_provinces_view.findViewById(R.id.setting_provinces_parent);
        listview_provinces = (ListView) popu_provinces_view.findViewById(R.id.setting_provinces_listview2);
        parent22.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                pop_provinces.dismiss();
            }
        });
    }

    private void popuwindow_type() {
        if (SELECT_TYPE == 0) {
            //检测模式
            MyAccountModeListAdapter = new MyAccountModeListAdapter(this, strModes);
        } else {
            //是否
            MyAccountModeListAdapter = new MyAccountModeListAdapter(this, yes_no_Modes);
        }
        listview_modes.setAdapter(MyAccountModeListAdapter);
        listview_modes.setOnItemClickListener(this);
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        switch (SELECT_TYPE) {
            case 0:
                //检测模式
                CURRENT_SELECT_TYPE = strModes.get(position);
                break;
            case 1:
                //是否
                CURRENT_SELECT_TYPE = yes_no_Modes.get(position);
                break;
        }
        switch (view_type) {
            case 3:
                settingModel.setJiance_xiangmu_moren(CURRENT_SELECT_TYPE);
                acSettingTxtMoren.setText(CURRENT_SELECT_TYPE);
                break;
//            case 4:
//                settingModel.setBianma(CURRENT_SELECT_TYPE);
//                acSettingTxtBianma.setText(CURRENT_SELECT_TYPE);
//                break;
//            case 5:
//                settingModel.setShijian_xianzhi(CURRENT_SELECT_TYPE);
//                acSettingTxtShijian.setText(CURRENT_SELECT_TYPE);
//                break;
//            case 6:
//                settingModel.setPhoto_clip(CURRENT_SELECT_TYPE);
//                acSettingTxtPaizhao.setText(CURRENT_SELECT_TYPE);
//                break;
        }
        pop.dismiss();
    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        SharedPreferencesUtils.setIsDaCheDiGouFenLi(this, isChecked);
        acSettingTxtDache.setChecked(isChecked);
    }
}
